#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>

using namespace std;

int removeDuplicates(vector<int>& nums) 
{
    int i = nums[0];
    vector<int>::iterator it = nums.begin() + 1;
    int j = 1;
    while (it < nums.end())
    {
        if (i == nums[j])
        {
            it = nums.erase(it);
        }
        else
        {
            i = nums[j++];
            it++;
        }
    }

    return nums.size();
}

int main()
{
    vector<int> nums = { 0,0,1,1,1,2,2,3,3,4 };
    int ret = removeDuplicates(nums);
    cout << ret << endl;

	return 0;
}